package com.yiwei.zhh.http;


import com.yiwei.zhh.api.Api;

import okhttp3.OkHttpClient;

/**
 * Created by caishenglang on 2016/11/5.
 */

public class OkHttpClientHelper {

    //    private OkHttpClient mHttpClient;
    private static OkHttpClientHelper mHelper;
    private final static long TIME_OUT = 10000;  //超时时间

    private OkHttpClientHelper() {
    }

    public static OkHttpClientHelper getInstance() {
        if (mHelper == null) {
            synchronized (OkHttpClientHelper.class) {
                if (mHelper == null) {
                    mHelper = new OkHttpClientHelper();
                }
            }
        }
        return mHelper;
    }

    public OkHttpClient getOkHttpClient() {
//        if (mHttpClient == null){
//            mHttpClient = new OkHttpClient.Builder()
//                    .connectTimeout(TIME_OUT, TimeUnit.SECONDS)
//                    .readTimeout(TIME_OUT, TimeUnit.SECONDS)
//                    .writeTimeout(TIME_OUT, TimeUnit.SECONDS)
//                    .addInterceptor(new TokenInterceptor())
//                    .build();
//        }
        return Api.okhttpClient;
    }
}
